Skip to content

Add wc_Sha256Free after the final use#930

Merged
ejohnstown merged 1 commit intowolfSSL:masterfrom
yosuke-wolfssl:f_2073
Apr 21, 2026
Merged

Add wc_Sha256Free after the final use#930
ejohnstown merged 1 commit intowolfSSL:masterfrom
yosuke-wolfssl:f_2073

Conversation

@yosuke-wolfssl
Copy link
Copy Markdown
Contributor

Four functions in agent.c call wc_InitSha256() followed by wc_Sha256Update() and wc_Sha256Final() on a stack-local wc_Sha256 variable, but never call wc_Sha256Free().
This PR adds it into each function after the final use of the sha context.

@yosuke-wolfssl yosuke-wolfssl self-assigned this Apr 17, 2026
Copilot AI review requested due to automatic review settings April 17, 2026 02:05
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates src/agent.c to properly release wolfCrypt SHA-256 contexts by adding wc_Sha256Free() calls after the final use of stack-local wc_Sha256 variables, preventing resource leaks in agent key ID hashing paths.

Changes:

  • Add wc_Sha256Free(&sha) after wc_Sha256Final() in PostAddRsaId().
  • Add wc_Sha256Free(&sha) after wc_Sha256Final() in PostAddEcdsaId().
  • Add wc_Sha256Free(&sha) after wc_Sha256Final() in PostRemoveId() and FindKeyId().

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/agent.c
@ejohnstown ejohnstown merged commit 2d981ae into wolfSSL:master Apr 21, 2026
131 checks passed
@yosuke-wolfssl yosuke-wolfssl deleted the f_2073 branch April 21, 2026 22:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants